package com.ywk.pattern._23_command;

import java.util.ArrayList;
import java.util.List;

public class Waiter {
    private List<Command> commands = new ArrayList<>();


    //设置订单
    public void setCommand(Command command) {
        commands.add(command);
    }

    //取消订单
    public void cancelCommand(Command command) {
        commands.remove(command);
    }
    //通知执行
    public void Notify() {
        for (Command command : commands) {
            command.executeCommand();
        }
    }
}
